home *** CD-ROM | disk | FTP | other *** search
/ SunSoft Catalyst CDWARE 1996 May to August / Catalyst CDWARE 1996 May to August.iso / .products / .bin / httpd / Solaris_2 / acroread < prev    next >
Text File  |  1996-04-01  |  5KB  |  247 lines

  1. #!/bin/sh
  2. #
  3. # vi:set ts=40 sw=2:
  4. #
  5. cat /tmp/httpd/.products/.bin/gui/AcroRead_lic.txt
  6.  
  7. cmd=acroread
  8. prod="Acrobat Reader"
  9. ver=2.1
  10. install_dir=/cdware/CDware/.products/.bin/httpd/Solaris_2
  11.  
  12. #
  13. # Prepend a colon seperated environment variable
  14. # $1 string to be prepended
  15. # $2 environment variable
  16. #
  17. prepend()
  18. {
  19.   if [ -z "$2" -o "$2" = "$1" ] ; then
  20.     echo "$1"
  21.   else
  22.     first="`expr "$2" : '\([^:]*\):'`"
  23.     if [ "$first" = "$1" ] ; then
  24.       echo "$2"
  25.     else
  26.       echo "${1}:${2}"
  27.     fi
  28.   fi
  29. }
  30.  
  31.  
  32. #
  33. # Tests the version file in an installation directory.
  34. #
  35. test_install_dir()
  36. {
  37.   if [ "$1" -a -f "$1/AcroVersion" ] \
  38.   && [ "`cat $1/AcroVersion 2>/dev/null`" = "$ver" ] ; then
  39.     return 0
  40.   else
  41.     return 1
  42.   fi
  43. }
  44.  
  45.  
  46. #
  47. # Get the current working directory.
  48. # Try to avoid automounter directories by checking
  49. # if $HOME or $PWD is the same directory as pwd,
  50. # and removing the automount directory component.
  51. #
  52. cwd="`pwd 2> /dev/null`"
  53. if [ -z "$cwd" -o ! -d "$cwd" ] ; then
  54.   echo "ERROR: Cannot determine current directory."
  55.   exit 1
  56. fi
  57.  
  58. if [ "$HOME" -a -d "$HOME" ] && [ "`cd / ; cd "$HOME" ; pwd`" = "$cwd" ] ; then
  59.   cwd="$HOME"
  60. elif [ "$PWD" -a -d "$PWD" ] && [ "`cd / ; cd "$PWD" ; pwd`" = "$cwd" ] ; then
  61.   cwd="$PWD"
  62. fi
  63.  
  64. if [ "$cwd" != / -a "${AUTOMOUNT_DIR=/tmp_mnt}" ] ; then
  65.   tmp="`expr "$cwd" : "$AUTOMOUNT_DIR"'\(.*\)'`"
  66.   if [ "$tmp" -a -d "$tmp" ] ; then
  67.     if [ "`cd / ; cd "$tmp" ; pwd`" = "`pwd`" ] ; then
  68.       cwd="$tmp"
  69.     fi
  70.   fi
  71. fi
  72.  
  73. PWD="$cwd"
  74. export PWD
  75.  
  76.  
  77. #
  78. # Setup ACRO_ARG0 to this script
  79. #
  80. arg0="$0"
  81. if [ "$arg0" ] ; then
  82.   case "$arg0" in
  83.      /*) ;;
  84.     ./*) arg0="$cwd/`expr "$arg0" : '\./\(.*\)'`" ;;
  85.       *) arg0="$cwd/$arg0" ;;
  86.   esac
  87.  
  88.   ACRO_ARG0="$arg0"
  89.   export ACRO_ARG0
  90. fi
  91.  
  92.  
  93. #
  94. # Try to find the installation directory
  95. #
  96. if ( test_install_dir "$install_dir" ) ; then
  97.   ACRO_INSTALL_DIR="$install_dir"
  98.   export ACRO_INSTALL_DIR
  99. else
  100.   script="$arg0"
  101.   while [ "$script" ] ; do
  102.     install_dir="`dirname "$script"`"
  103.     if ( test_install_dir "$install_dir" ) ; then
  104.       ACRO_INSTALL_DIR="$install_dir"
  105.       export ACRO_INSTALL_DIR
  106.       break
  107.     fi
  108.  
  109.     install_dir="`dirname "$install_dir"`"
  110.     if ( test_install_dir "$install_dir" ) ; then
  111.       ACRO_INSTALL_DIR="$install_dir"
  112.       export ACRO_INSTALL_DIR
  113.       break
  114.     fi
  115.  
  116.     if [ -h "$script" ] ; then
  117.       new_script=`ls -l "$script" | sed 's/^.*-> *\(.*\) *$/\1/'`
  118.       if [ "$new_script" -a "`expr "$new_script" : '/.*'`" = 0 ] ; then
  119.         new_script="`dirname "$script"`/$new_script"
  120.       fi
  121.       script="$new_script"
  122.     else
  123.       break
  124.     fi
  125.   done
  126.  
  127.   if ( test_install_dir "$ACRO_INSTALL_DIR" ) ; then
  128.     :
  129.   elif ( test_install_dir "$ACRO_HOME" ) ; then
  130.     ACRO_INSTALL_DIR="$ACRO_HOME"
  131.     export ACRO_INSTALL_DIR
  132.   else
  133.     echo "ERROR: Cannot find installation directory."
  134.     exit 1
  135.   fi
  136. fi
  137.  
  138.  
  139. #
  140. # setup the configuration from uname
  141. #
  142. os_name=`uname -s`
  143. os_release=`uname -r`
  144.  
  145. case "$os_name" in
  146.   SunOS)
  147.     case "$os_release" in
  148.       4.1.3*|4.1.4*)
  149.         ACRO_CONFIG=sparcsun
  150.         export ACRO_CONFIG
  151.         ;;
  152.       5.*)
  153.         ACRO_CONFIG=sparcsolaris
  154.         export ACRO_CONFIG
  155.         ;;
  156.     esac
  157.     ;;
  158.   HP-UX)
  159.     ACRO_CONFIG=hppahpux
  160.     export ACRO_CONFIG
  161.     ;;
  162. esac
  163.  
  164. if [ -z "$ACRO_CONFIG" ] ; then
  165.   echo "The OS named $os_name version $os_release is currently not supported."
  166.   echo "Try running on a supported platform and connecting to your display."
  167.   echo "Supported platforms include the following:"
  168.   echo "  SPARC/SunOS version 4.1.3 or 4.1.4"
  169.   echo "  SPARC/Solaris version 2.x"
  170.   echo "  HP/HP-UX version 9.0.x and 10.x"
  171.   exit 1
  172. fi
  173.  
  174.  
  175. #
  176. # XXX No LANG
  177. #
  178.  
  179.  
  180. #
  181. # Setup XKEYSYMDB
  182. #
  183. if [ -z "$XKEYSYMDB" -o ! -f "$XKEYSYMDB" ] ; then
  184.   if [ -f "$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib/XKeysymDB" ] ; then
  185.     XKEYSYMDB="$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib/XKeysymDB"
  186.     export XKEYSYMDB
  187.   elif [ -f "$ACRO_INSTALL_DIR/XKeysymDB" ] ; then
  188.     XKEYSYMDB="$ACRO_INSTALL_DIR/XKeysymDB"
  189.     export XKEYSYMDB
  190.   fi
  191. fi
  192.  
  193.  
  194. #
  195. # Prepend XFILESEARCHPATH
  196. #
  197. XFILESEARCHPATH="`prepend "$ACRO_INSTALL_DIR/$ACRO_CONFIG/%T/%N%S" "$XFILESEARCHPATH"`"
  198. export XFILESEARCHPATH
  199.  
  200.  
  201. #
  202. # Setup configuration specific environment variables
  203. #
  204. case "$ACRO_CONFIG" in
  205.   sparcsun)
  206.     LD_LIBRARY_PATH="`prepend "$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib" "$LD_LIBRARY_PATH"`"
  207.     export LD_LIBRARY_PATH
  208.     XNLSPATH="$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib/nls"
  209.     export XNLSPATH
  210.     ;;
  211.   sparcsolaris)
  212.     LD_LIBRARY_PATH="`prepend "$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib" "$LD_LIBRARY_PATH"`"
  213.     export LD_LIBRARY_PATH
  214.     if [ -z "$LC_CTYPE" ] ; then
  215.       LC_CTYPE="iso_8859_1"
  216.       export LC_CTYPE
  217.     fi
  218.     ;;
  219.   hppahpux)
  220.     SHLIB_PATH="`prepend "$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib" "$SHLIB_PATH"`"
  221.     export SHLIB_PATH
  222.     ;;
  223. esac
  224.  
  225.  
  226. #
  227. # Set the command.  Process any debug flags and exec.
  228. #
  229. ACRO_EXEC_CMD="$ACRO_INSTALL_DIR/$ACRO_CONFIG/bin/$cmd"
  230.  
  231. if [ "$1" = "-DEBUG" ] ; then
  232.   if [ $# = 1 ] ; then
  233.     export ACRO_EXEC_CMD
  234.     exec "$SHELL"
  235.   else
  236.     shift
  237.     exec ${1+"$@"} "$ACRO_EXEC_CMD"
  238.   fi
  239. fi
  240.  
  241. if [ -f "$ACRO_EXEC_CMD" ] ; then
  242.   exec "$ACRO_EXEC_CMD" ${1+"$@"}
  243. else
  244.   echo "ERROR: $prod not installed for this configuration, \"$ACRO_CONFIG\"."
  245.   exit 1
  246. fi
  247.